import fetch from 'utils/fetch';
/**
 * 活动管理
 */
//获取官方活动分页列表
export function findActivityByPage(page,rows,provinceId,cityId,areaId,title,status,creatorId) {
    const data = {
        provinceId,
        cityId,
        areaId,
        title,
        status,
        creatorId
    };
    return fetch({
        // /activity/query/{page}/{rows}
        url: '/activity/query/'+page+'/'+rows,
        method: 'post',
        data
    });
  }

// //获取创建人列表
// export function findCreater(creatorName) {
//     const data = {
//         creatorName
//     };
//     return fetch({
//         url: '/activity/getCreatorList',
//         method: 'post',
//         data
//     });
//   }

//官方活动上线下线
export function onlineOrDown(id,status) {
    const data = {
        id,
        status
    };
    return fetch({
        url: '/activity/onlineOrDown',
        method: 'post',
        data
    });
  }

//查看活动详情
export function getDetail(id) {
    const data = {
        id
    };
    return fetch({
        url: '/activity/getDetail',
        method: 'post',
        data
    });
}

//删除（批量删除）活动
export function getDelete(id) {
    const data = {
        id
    };
    return fetch({
        url: '/activity/getDelete',
        method: 'post',
        data
    });
}

//编辑活动
export function changeActivity(id,title,picture,htmlUrl,html,provinceId,cityId,areaId,desc) {
    const data = {
        id,
        title,
        picture,
        htmlUrl,
        html,
        provinceId,
        cityId,
        areaId,
        desc
    };
    return fetch({
        url: '/activity/changeActivity',
        method: 'post',
        data
    });
}

//添加活动
export function addActivity(title,picture,htmlUrl,html,provinceId,cityId,areaId,desc) {
    const data = {
        title,
        picture,
        htmlUrl,
        html,
        provinceId,
        cityId,
        areaId,
        desc
    };
    return fetch({
        url: '/activity/addActivity',
        method: 'post',
        data
    });
}

// 上传
export function uploadActivity(title,picture,html,desc,createTime) {
    const data = {
        title,
        picture,
        html,
        desc,
        createTime
    };
    return fetch({
        url: '/activity/uploadActivity',
        method: 'post',
        data
    });
}